/**
 * 编辑个性签名
 * page个性签名
 */
import 'package:flutter/material.dart';
import 'package:qgchat/common/global/global.dart';

class Sign extends StatefulWidget {
  Sign({
    @required this.signature,
  });

  final String signature;

  @override
  _SignState createState() => _SignState();
}

class _SignState extends State<Sign> {

  TextEditingController iptSignature;

// life ------------------------------------------------------------------------

  @override
  void initState() {
    if (widget.signature != null) {
      iptSignature = TextEditingController(text: widget.signature);
    } else {
      iptSignature = TextEditingController();
    }
  }

// methods ---------------------------------------------------------------------

  // 保存签名
  keepSign() {
//    print(iptSignature.text);
    Navigator.of(context).pop(iptSignature.text);
  }

  // body

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: PreferredSize(
        preferredSize: Size.fromHeight(px(88)),
        child: AppBar(
          centerTitle: true,
          title: Text(
            "个性签名",
            style: TextStyle(
              color: Colors.black,
              fontSize: px(34),
              fontWeight: FontWeight.bold,
            ),
          ),
          actions: <Widget>[
            Container(
              width: px(125),
              child: FlatButton(
                onPressed: keepSign,
                padding: EdgeInsets.zero,
                child: Text(
                  "保存",
                  style: TextStyle(
                    color: col("5640c6"),
                    fontSize: px(34),
                  ),
                ),
              ),
            )
          ],
        ),
      ),
      body: Container(
        width: w100(context),
        color: Colors.white,
        padding: EdgeInsets.symmetric(horizontal: px(50)),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Container(
              margin: EdgeInsets.only(top: px(30)),
              child: Text(
                "简单介绍以下您自己，这样其他朋友就可以了解您",
                style: TextStyle(
                  color: col("606266"),
                  fontSize: px(26),
                ),
              ),
            ),
            Container(
              margin: EdgeInsets.only(top: px(96)),
              child: TextField(
                controller: iptSignature,
                maxLines: 1,
                maxLength: 20,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
